package com.wen.mall.product.web;

import com.wen.mall.product.service.SkuInfoService;
import com.wen.mall.product.vo.SkuItemVo;
import lombok.SneakyThrows;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.concurrent.ExecutionException;

/**
 * @author 为`QWQ`
 * @date 2022/9/28
 * @description: TODO
 **/
@Controller
public class ItemController {

    @Autowired
    private SkuInfoService skuInfoService;

    /**
     * 商品详情页
     * @param skuId
     * @param model
     * @return String
     */
    @GetMapping("/{skuId}.html")
//    @SneakyThrows({ExecutionException.class, InterruptedException.class})
    public String skuItem(@PathVariable("skuId") Long skuId, Model model){
        SkuItemVo vos = skuInfoService.item(skuId);
        model.addAttribute("item",vos);
        return "item";
    }
}
